package sk.robocup.dvanastyhrac.actionfactories;

import robocup.component.WorldModel;
import robocup.component.actionfactories.SayActionFactory;
import robocup.component.actions.SayAction;
import robocup.component.speechacts.MessageFactory;
import robocup.component.worldobjects.Ball;
import robocup.component.worldobjects.Player;

/**
 * Trieda ktora vyraba objekty SayAction tak ako potrebujeme v nasich stavoch
 * Created on 17.3.2009 at 16:39:43
 * @author gpan
 */
public class SayActionFactory12 extends SayActionFactory {

    /**
     * Metoda vrati SayAction na zaklade nahravky a hraca ktoremu sa ide nahravat
     * @param resultingPassBall - Po vykonani prihravky bude lopta v takomto stave
     * @param passTo - hrac, ktoremu sa bude nahravat
     * @return sprava v ktorej su zakomponovane informacie o nahravke a cieli.
     */
    public static SayAction getPassSayAction(WorldModel world, Ball resultingPassBall) {
        MessageFactory mf = world.getMessageFactory();
        return new SayAction(mf.encodeKickedBall(resultingPassBall));
    }

    /**
     * Metoda vytvori SayAction , v ktorej je zakodovana pozicia driblujuceho hraca a pozicia dalsieho hraca. (nie ich rychlosti, pozri DRIBBLE_PPOS v MessageFactory)
     *
     * @param world worldModel hraca
     * @param dribblingPlayer driblujuci hrac (najcastejsie je to ten co tu spravu krici)
     * @param anyOtherPlayer (hociaky iny hrac)
     * @param age vek spravy (0 az 2) kolko cyklov je sprava stara (asi...)
     * @return sprava so zakodovanymi hracmi
     */
    public static SayAction getDribbleSayAction(WorldModel world, Player dribblingPlayer, Player anyOtherPlayer, int age) {
        MessageFactory mf = world.getMessageFactory();
        return new SayAction(mf.encodeDribblePlayer(dribblingPlayer, anyOtherPlayer, age));

    }

    public SayActionFactory12() {
    }
}
